<?
##########################################################################
#		DOCUMENTATION
##########################################################################
# Class that extends the core class. This module will provide the methods
# needed by the site to access editors' informations.
#
# © LiberLab group, 2011
##########################################################################

require_once("core.php");

class Editor extends Core{
	public function __construct() {
		parent::__construct();
	}
	
	public function getEditors($limit, $startId, $fresh = true){
		# get all the editors
		$database = self::$database;
		$cache = self::$cache;

		$query = 'SELECT * FROM editors';
		$query = $this->limitAddon($query, $limit, $startId);

		$res = $this->queryCache($query);
		$queryCacheRes = $res[0]; $queryCache = $res[1];

		# have we have already done this query? Yes? Return it
		if (!$fresh and $queryCacheRes){
			return $cache[$queryCache]["data"];
		}
		# if where here means that we haven't returned yet, so it's correct
		$rows = $database->query($query);
		$this->cacheInsert($rows, $queryCache);

		if ($rows){			
			return $rows;
		}
		return null;
	}

	public function __destruct() {
		parent::__destruct();
	}
};

?>
